package com.lanhao.aot.wakeup;

import java.util.concurrent.TimeUnit;

import com.alibaba.fastjson.JSONObject;

import cn.hutool.core.lang.UUID;
import cn.hutool.http.HttpRequest;

public class WakeupTestUtil {
	public static void main(String[] args) {
		while (true) {
			for (int i = 0; i < 30; i++) {
				new Thread(() -> {
					doWakeupPost();
				}).start();
			}
			try {
				TimeUnit.MILLISECONDS.sleep(200);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}

		}
	}

	public static void doWakeupPost() {
		JSONObject param = new JSONObject();
		param.put("wakeupParam",
				"{\"keyword\":\"xiao3 fei1 xiao3 fei1\",\"wakeupdelay\":0,\"wakeupthreshold\":450,\"ivwinfo\":{\"ivw_keyword_id\":0,\"ivw_start_ms\":1990,\"ivw_end_ms\":2790,\"current_ms\":3200},\"angle\":95,\"channel\":1,\"power\":930824126464.00,\"cmScore\":1048,\"beam\":1}");
		param.put("iotAccount", "18130064532");
		param.put("deviceId", UUID.fastUUID().toString());

		String body = HttpRequest.post("https://qiyema.heihetech.com/cloud/wakePolicyDecision")
				.body(param.toJSONString()).execute().body();
		System.out.println("返回结果:" + body);
	}
}
